package csel.model.entity;

import org.apache.log4j.Logger;

import csel.model.*;
import csel.model.items.*;

public abstract class Entity extends MobileObject
{
	private static final long serialVersionUID = 6L;
	
	private static final Logger logger = Logger.getLogger("csel.model");
	
	private String name;

	public Entity(String typeId)
	{
		super(typeId);
		
		name = "The Man With No Name";
	}
	
	public Entity(String typeId, String name)
	{
		super(typeId);
		
		this.name = name;
	}

	public String getName()
	{
		return name;
	}
	
	public double getResistance(DamageTypes dT)
	{
		return (0); // TODO
	}

	public void setResistance(DamageTypes dT, double res)
	{
		// TODO
	}
	
	/* INTERACTION */
	
	public abstract boolean canEnter(MobileObject obj, BlockNotifier notifier);

	public abstract void touch(Entity e);

	public abstract boolean touch(UseableItem ui);
	
	public abstract boolean touch(EquippableItem ei);
	
	public abstract void levelUp();
	
	public abstract void die();
	
	public abstract UseableItem stealFrom();
	
	public void pissTaitOff(Character c){}
	/* COMBAT */

	public abstract void damage(DamageTypes dT, int dam);
	
	
	/* MOVEMENT */

	@Override
	protected void enterTile(Tile tile)
	{
		tile.enter(this);
	}

	@Override
	protected void leaveTile()   // subclasses can override BUT CALL SUPER()
	{
		logger.debug(String.format("%s leaving tile.", this));
		
		getTile().leave(this);
	}
}
